package com.gthncz;

import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.gthncz.beans.Profile;
import com.gthncz.beans.Student;

public class AnnotationDemo {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		AbstractApplicationContext context = new ClassPathXmlApplicationContext("Beans_annotation.xml");
		Student student = (Student) context.getBean("student");
		System.out.printf(" Student name: %s, age: %d \n", student.getName(), student.getAge());
		Profile profile = (Profile) context.getBean("profile");
		profile.printName(); profile.printAge();
		context.registerShutdownHook();
	}

}
